package scuba.DiveBuddy;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import scuba.DiveBuddy.Class.GraphViews;
import scuba.DiveBuddy.Enums.GraphViewEnum;

/**
 * @author Alex Anderson
 * @version 1.0
 * @since {12/03/14}
 */
public class MetricsActivity extends Activity
    implements Button.OnClickListener {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.activity_metrics);

        //todo: add button listeners
        Button b = (Button)findViewById(R.id.btnTotalDiveTime);
        b.setOnClickListener(this);

        b = (Button)findViewById(R.id.btnAirConsumption);
        b.setOnClickListener(this);

        b = (Button)findViewById(R.id.btnDiveDurations);
        b.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        if(view == null)
            return;

        switch(view.getId()) {

            case R.id.btnDiveDurations:
                GraphViews.Graph = GraphViewEnum.DiveDuration;
                invokeGraph();
                break;

            case R.id.btnAirConsumption:
                GraphViews.Graph = GraphViewEnum.AirConsumption;
                invokeGraph();
                break;

            case R.id.btnTotalDiveTime:
                GraphViews.Graph = GraphViewEnum.TotalDiveTime;
                invokeGraph();
                break;

            default:
                break;
        }
    }

    private void invokeGraph() {
        startActivity(new Intent(this, GraphViewerActivity.class));
    }
}